home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / obj2asm.zip / ORLINNUM.C < prev    next >
Text File  |  1991-10-02  |  1KB  |  50 lines

  1. #include <stdio.h>
  2. #include <ctype.h>
  3. #include <string.h>
  4. #include "o.h"
  5.  
  6.  
  7. int linnum_compare(LINE_T *btreeline, LINE_T*line)
  8. {
  9.     if ( btreeline->hex_offset > line->hex_offset ) {
  10.         return( LEFT );
  11.     } else {
  12.         if ( btreeline->hex_offset < line->hex_offset ) {
  13.             return( RIGHT );
  14.         } else {
  15.             return( EQUAL );
  16.         }
  17.     }
  18. }
  19.  
  20.  
  21. void linnum( word length)
  22. {
  23.   char            *record;
  24.   char            text[80];
  25.   char            cksum;
  26.   int             i;
  27.   LINE_T          *line;
  28.  
  29.   get_byte();
  30.   get_byte();
  31.   length -= 3;
  32.   record = o_malloc(length);
  33.   get_str( length, record );
  34.   i = 0;
  35.   while (length) {
  36.     line = (LINE_T*)o_malloc(sizeof(LINE_T));
  37.     line->hex_offset = *(word*)&record[i+2];
  38.     line = insert(line, line_tree, TC linnum_compare)->data;
  39.     line->line_number = *(word*)&record[i];
  40.     sprintf(text, "; %4d: %04X",line->line_number,line->hex_offset);
  41.     out_line(text,"","","");
  42.     out_newline();
  43.     i+=4;
  44.     length-=4;
  45.   }
  46.   out_newline();
  47.   cksum = get_byte();
  48.   cksum = cksum;
  49. }
  50.